package com.pomr.entity.bigscr;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @作者：wgchao
 * @时间：17:49 2019/6/13 0013
 * @用途：
 **/
@Data
public class PersonInfo implements Serializable {
    private String name;
    private String idcard;
    private Date birth;
    private String sexName;
    private String etype;//设备
    private String spec;//型号
    private String tel;

    public static PersonInfo getinstance(Object[] list){
        PersonInfo personInfo = new PersonInfo();
        personInfo.name = list[0].toString();
        personInfo.idcard = list[1].toString();
        personInfo.birth =  list[2]==null?null: (Date)list[2];
        if(list[3] == null){
            personInfo.sexName = "未知";
        }else{
            int sex = (int) list[3];
            if(sex==1){
                personInfo.sexName = "男";
            }else if(sex==2){
                personInfo.sexName = "女";
            }else{
                personInfo.sexName = "未知";
            }
        }

      //  personInfo.sexName = sex==1?"男":"女";
        personInfo.etype = list[5].toString();
        personInfo.spec = list[6].toString();
        return personInfo;
    }

    public static List<PersonInfo> instancelist(List<Object[]> list){
        List<PersonInfo> personInfos = new ArrayList<>();
        for(Object[] l:list){
            personInfos.add(getinstance(l));
        }
        return personInfos;
    }
}
